﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace System.Data.Cassandra.Configuration
{
    public class CassandraConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("port", DefaultValue = 9160, IsRequired = false)]
        [IntegerValidator(ExcludeRange = false, MaxValue = Int32.MaxValue, MinValue = 1)]
        public Int32 Port
        {
            get
            {
                return (Int32)this["port"];
            }
        }

        [ConfigurationProperty("minPoolCountPerHost", DefaultValue = 2, IsRequired = false)]
        [IntegerValidator(ExcludeRange = false, MaxValue = Int32.MaxValue, MinValue = 2)]
        public Int32 MinPoolCountPerHost
        {
            get
            {
                return (Int32)this["minPoolCountPerHost"];
            }
        }

        [ConfigurationProperty("maxPoolCountPerHost", DefaultValue = Int32.MaxValue, IsRequired = false)]
        [IntegerValidator(ExcludeRange = false, MaxValue = Int32.MaxValue, MinValue = 2)]
        public Int32 MaxPoolCountPerHost
        {
            get
            {
                return (Int32)this["maxPoolCountPerHost"];
            }
        }

        [ConfigurationProperty("timeout", DefaultValue = 10000.0, IsRequired = false)]
        //TODO: Create DoubleValidator
        public Double Timeout
        {
            get
            {
                return (Double)this["timeout"];
            }
        }

        [ConfigurationProperty("servers")]
        public ServerElementCollection Servers
        {
            get { return (ServerElementCollection)this["servers"]; }
        }
    }
}